package leetcode;/*
package leetcode;

*/
/**
 * @author Liangyaoyun
 */

public class leetCode392 {


    //s是子串，t是主串
    public boolean isSubsequence(String s, String t) {

        //主串长度
        int n = t.length();
        //子串长度
        int m = s.length();
        //主串下标
        int i = n - 1;
        //子串下标
        int j = m - 1;
        while (i >= 0 && j >= 0) {
            if (s.charAt(j)==t.charAt(i))
            {
                i--;
                j--;
            }else{
                i--;
            }
        }
        if (j==-1){
            return true;
        }
        return false;
    }
}
